package com.kasinf.sample.log.config;

import com.kasinf.framework.cache.utils.RedisUtils;
import com.kasinf.framework.common.pojo.log.LogDTO;
import com.kasinf.framework.log.server.service.EsLogService;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * mq日志订阅
 *
 * @Author : Kaiser
 * @Date: 2025/7/1  17:34
 */
@Component
@RequiredArgsConstructor
public class LogSubService {

    private final EsLogService esLogService;

    @PostConstruct
    public void init(){
        RedisUtils.subscribe("redis-log-message", LogDTO.class, esLogService::saveLog);
    }
}
